<?php
/**
 * 文章
 * User: cxm
 * Date: 2020/8/16
 * Time: 14:54
 */
namespace Seeds\Admin;

use App\Models\AdminPermission;
class ArticleSeeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public static function run()
    {
        // 一级
        $article = AdminPermission::create([
            'pid' => 0, 'sort' => 190, 'http_method' => ['GET'], 'name' => '文章管理', 'fid' => null, 'icon' => 'el-icon-chat-square',
            'http_path' => 'javascript', 'menu_switch' => 2
        ]);

        /** ++++++++++++++++++++++++++++ 文章管理 start ++++++++++++++++++++++++++++++++++*/
        $index = AdminPermission::create([
            'pid' => $article->id, 'sort' => 10, 'http_method' => ['GET'], 'name' => '文章管理', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'article_list','http_path' => 'javascript', 'menu_switch' => 2
        ]);

        // 列表
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '列表', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/article/getLists', 'menu_switch' => 1
        ]);

        // 处理
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '添加、编辑处理', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/article/store', 'menu_switch' => 1
        ]);

        // 删除
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '删除', 'fid' => null, 'icon' => 'ios-book',
            'url'=>'','http_path' => '/admin/article/delete', 'menu_switch' => 1
        ]);

        // 排序
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '排序', 'fid' => null, 'icon' => '',
            'url'=>'','http_path' => '/admin/article/updateSort', 'menu_switch' => 1
        ]);

        // 显示隐藏
        AdminPermission::create([
            'pid' => $index->id, 'sort' => 10, 'http_method' => ['POST'], 'name' => '显示隐藏', 'fid' => null, 'icon' => '',
            'url'=>'','http_path' => '/admin/article/updateStatus', 'menu_switch' => 1
        ]);
        /** ++++++++++++++++++++++++++++ 文章管理 end ++++++++++++++++++++++++++++++++++*/

    }
}